from rest_framework import mixins, viewsets
from api.models import SysMenu
from api.serializers import UserMenuSerializer, UserMenuSerializer
from api.filters import UserMemuFilter
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.filters import SearchFilter

class UserMenuRouterViewSet(
    viewsets.GenericViewSet,
    mixins.ListModelMixin
):
    queryset = SysMenu.objects.all()
    serializer_class = UserMenuSerializer
    filter_backends = [SearchFilter, DjangoFilterBackend]  #
    search_fields = ['menu_name']
    filterset_class = UserMemuFilter